<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>药物临床试验机构资格认定证书</title>
<style type="text/css">
.reg_form_table{
	width: 100%;clear:both;font-size:14px; font-family:"微软雅黑", "宋体"; color:#666666; text-align:right;
}
.reg_form_table td{
	height: 30px;
}
.texboxReg {
	 width:386px; padding: 2px 5px; border: 1px solid rgb(153, 153, 153); height: 22px; color: rgb(0, 0, 255); line-height: 22px; margin-right: 3px; background-color: rgb(255, 255, 255);
}
</style>
<script type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" href="/js/kindeditor-4.1.10/themes/default/default.css" />
<script type="text/javascript" src="/scripts/jquery.min.js"></script>
<script src="/js/kindeditor-4.1.10/kindeditor.js"></script>
<script src="/js/kindeditor-4.1.10/lang/zh_CN.js"></script>
</head>
<body>

<div>
<input type="hidden" id="id" name="id" value="<%if(request.getParameter("id")!=null) out.print(request.getParameter("id")); %>">
<table class="reg_form_table">
	    <tr height="40">
			<td width="90">PDF文件：</td>
			<td align="left">
			  &nbsp; <a href="javascript:void(0)" id="pdf_file" class="btn btn-sm blue"> &nbsp; 选择文件 </a>
			  <input type="hidden" id="pdf" name="pdf" />
			  &nbsp;
			  <span id="pdf_span"></span><span id="note_pdf"></span>
			</td>
		</tr>
		<tr height="40">
			<td>证书编号：</td>
			<td align="left">
			  &nbsp; <input id="certNumber" name="certNumber" value="" type="text" class="texboxReg" />
			  <span id="note_certNumber"></span>
			</td>
		</tr>
		<tr height="40">
			<td>认定专业：</td>
			<td align="left">
			  &nbsp; <input id="affirmationProfession" name="affirmationProfession" value="" type="text" class="texboxReg" />
			  <span id="note_affirmationProfession"></span>
			</td>
		</tr>
		<tr height="40">
			<td>有效期：</td>
			<td align="left">
			  &nbsp; <input id="startDate" name="startDate" value="" type="text" class="texboxReg Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 170px;" />
			  至
			  &nbsp; <input id="endDate" name="endDate" value="" type="text" class="texboxReg Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width: 170px;" />
			  <span id="note_endDate"></span>
			</td>
		</tr>
	   </table>

</div>

<script type="text/javascript">

$(function() {
	findCertificate();
});

function findCertificate() {
	var id = $("#id").val();
	$.ajax({
		url : '/admin/org!findCertificate.action',
		type : 'post',
		data: {
			"id": id
		},
		dataType: 'json',
		success : function(data) {
		     if(data!=null && data!='') {
		    	 $("#pdf").val(data[0].pdf);
				 if(data[0].pdf!=null && data[0].pdf!='') {
					var array = data[0].pdf.split('/');
				 	$("#pdf_span").html("已上传文件：<a href='" + data[0].pdf + "' target='_blank'>" + array[array.length-1] + "</a>");
				 }
		    	 $("#certNumber").val(data[0].certNumber);
		    	 $("#affirmationProfession").val(data[0].affirmationProfession);
		    	 $("#startDate").val(data[0].startDate);
		    	 $("#endDate").val(data[0].endDate);
		     }
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			// 保存失败
			alert('error:' + textStatus);
		}
    });
}

// 上传文件
KindEditor.ready(function(K) {

	var editor = K.editor({
		uploadJson : '/js/kindeditor-4.1.10/jsp/upload_json.jsp'
		//fileManagerJson : '/assets/plugins/kindeditor-4.1.10/jsp/file_manager_json.jsp',
		//allowFileManager : true
	});
	
	K('#pdf_file').click(function() {
		editor.loadPlugin('image', function() {
			editor.plugin.imageDialog({
				showRemote : false, //隐藏图片浏览
				imageUrl : K('#pdf').val(),
				clickFn : function(url, title, width, height, border, align) {
					$("#pdf").val(url);
					var array = url.split('/');
					$("#pdf_span").html("已上传文件：<a href='" + url + "' target='_blank'>" + array[array.length-1] + "</a>");
					editor.hideDialog();
				}
			});
		});
	});
	
});	
</script> 

</body>
</html>